﻿using Cms.Core.Application.Service.UserInfo.Dto;
using Cms.Core.Data.Model;
using Cms.Core.Infrastructure.Dependency;
using Cms.Core.Infrastructure.Ui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cms.Core.Application.IService.UserInfo
{
    /// <summary>
    /// 用户信息接口
    /// </summary>
  public  interface IUserService : ITransientDependency
    {

        /// <summary>
        /// 异步添加用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<OperationResult> AddUserAsync(UserDto input);



        /// <summary>
        /// 异步更新用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<OperationResult> UpdateUserAsync(UserDto input);

        /// <summary>
        /// 异步添加或更新用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<OperationResult> AddOrUpdateUserAsync(UserDto input);

        /// <summary>
        /// 得到用户分页信息
        /// </summary>
        /// <param name="inputDto">分页请求数据</param>
        /// <returns></returns>

        Task<PageResult> GetUserPageDataAsync(PageInputDto inputDto);



        /// <summary>
        /// 检查登录信息
        /// </summary>
        /// <param name="accountNumber">账号</param>
        /// <param name="password">密码</param>
        /// <param name="isEncryption">是否对密码进行加密</param>
        /// <returns></returns>
        Task<OperationResult<TokenResultDto>> VerificationLoginInfo(string accountNumber, string password, bool isEncryption = true);

        /// <summary>
        /// 根据ID得到用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<UserDto> GetUserById(Guid id);

        /// <summary>
        /// 异步加载用户表单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        Task<OperationResult<UserDto>> LoadUserInfoAsync(Guid? id);

        /// <summary>
        /// 异步软删除
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        Task<OperationResult> SoftDeleteUserAsync(Guid id);

        /// <summary>
        /// 
        /// </summary>
        IQueryable<SysUser> Users { get; }

        /// <summary>
        ///刷新Token
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        Task<OperationResult<TokenResultDto>> RefreshToken(string token);

        /// <summary>
        /// 根据名字查询用户
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns></returns>
        Task<UserDto> FindUserByNameAsync(string userName);
    }
}
